package com.itheima.springboottilasmanager.survice.deptsurvice;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.springboottilasmanager.mapper.OperateLogMapper;
import com.itheima.springboottilasmanager.pojo.domain.PageResult;
import com.itheima.springboottilasmanager.pojo.domain.OperateLog;
import com.itheima.springboottilasmanager.pojo.vo.queryString;
import com.itheima.springboottilasmanager.survice.LogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class LogServiceIML implements LogService {


    @Autowired
    private OperateLogMapper opLog;
    @Override
    public PageResult<OperateLog> page(queryString qs) {
        PageHelper.startPage(qs.getPage(), qs.getPageSize());
        Page<OperateLog> page = (Page<OperateLog>) opLog.page(qs);
        PageResult<OperateLog> pageResult = new PageResult<>();
        pageResult.setTotal(page.getTotal());
        pageResult.setRows(page.getResult());
        return pageResult;
    }
}
